{
  "properties" : { },
  "id" : "757d3fddb8764ed1bd3bad117cd29e70",
  "script" : null,
  "groupId" : "74af8e1135d2474eb9b6b4081e6d5967",
  "name" : "获取拓扑图信息",
  "createTime" : 1727071051217,
  "updateTime" : 1726653335526,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "detail",
  "method" : "GET",
  "parameters" : [ {
    "name" : "deptid",
    "value" : "5",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 500,\n    \"success\": false,\n    \"data\": {},\n    \"msg\": \"系统维护中，请稍后重试。\"\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  },
  "responseBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }
}
================================
import response

var detail = db.table("ndmp_topo_msg").where().eq("isvalid", '1').eq("deptid", deptid).selectOne()


return response.download(detail.get("gplot"), detail.get("toponame"));

// ServletOutputStream out = null;
// try {
//     if (null != detail) {
//         String encode = URLEncoder.encode(detail.get("toponame"), "UTF-8").replace("+", "%20");
//         response.setHeader("Content-disposition", "attachment;filename=" + encode + ";topoid=" + detail.getTopoid());
//         var gplot = detail.get("gplot");
//         InputStream is = null;
//         if (null != gplot && gplot.length > 0) {
//             is = new ByteArrayInputStream( detail.get("gplot"));
//             response.setContentType("application/octet-stream");
//             out = response.getOutputStream();
//             int len = 0;
//             byte[] buf = new byte[1024];
//             while ((len = is.read(buf, 0, 1024)) != -1) {
//                 out.write(buf, 0, len);
//             }
//             out.flush();
//             out.close();
//         } else {
//             String res = "暂无此网点信息";
//             response.getOutputStream().write(res.getBytes());
//         }
//     } else {
//         String res = "暂无此网点信息";
//         response.getOutputStream().write(res.getBytes());
//     }
// } catch (IOException e) {
//     log.error("getTopoDetail is fail--->{}", e.getMessage());
// }